UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZNe7N99fF+4VfR7Kj6In/3gYBDf3tQvKPCL+ps9+91Q=' 
WHERE 
  key_id = 'f2d09bf18e1e707b423b33022f8826a66c494840af726f6a877e7e25c9a877bf' 
  AND (
    token = 'ZNe7N99fF+4VfR7Kj6In/3gYBDf3tQvKPCL+ps9+91Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028