UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9sYe1QaOubLJjHup6UfTZ44SarEVFkqvGferRlCP+TM=' 
WHERE 
  key_id = '94ea7d0698a267756df670dc0832757f811578911c06f553c1a5c7beb60f71b1' 
  AND (
    token = '9sYe1QaOubLJjHup6UfTZ44SarEVFkqvGferRlCP+TM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063