UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b30keSI3tTAA4EjRFXzyDmPpnYb3DoX66uRlNMxFXXs=' 
WHERE 
  key_id = 'd49616c67b0e9422d537037ddb730ae42a584cf972c199b6e092239f9c987691' 
  AND (
    token = 'b30keSI3tTAA4EjRFXzyDmPpnYb3DoX66uRlNMxFXXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034