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

Query time 0.00052