UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fXXoFYCbGDN5OpUh03oXuaDdsM8a1PZsWz+UzW1NcWg=' 
WHERE 
  key_id = '8af90b03b5e0d248e3bb23ce66b2c3c6864b06d6a34ecd272241111df489b104' 
  AND (
    token = 'fXXoFYCbGDN5OpUh03oXuaDdsM8a1PZsWz+UzW1NcWg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040