UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UZ5l27+9ar218RDziAGNLvIbLIuVqDFb6qI1LeSbOjw=' 
WHERE 
  key_id = 'b78d189a7eace52175f9505919cbac913c9dee389210e9557365d06c0f2730b4' 
  AND (
    token = 'UZ5l27+9ar218RDziAGNLvIbLIuVqDFb6qI1LeSbOjw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043