UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nP+9GpmTFAvsvWCuJ8oTjgNXogFO8hwNBEnu4N8Ys20=' 
WHERE 
  key_id = '5ab029fc7d47deec4a1981f0c39e2f92e32a4d46559e9038668d544127c03e2b' 
  AND (
    token = 'nP+9GpmTFAvsvWCuJ8oTjgNXogFO8hwNBEnu4N8Ys20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030