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

Query time 0.00034