UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ykYF/Aeu/AvXA9Z2s0Dhfx7VKFRlSl1wUCISc7iW3Rc=' 
WHERE 
  key_id = 'f6a49540faa258356f71132df90272b9b542d32510a2b87e4c96020ca6e77872' 
  AND (
    token = 'ykYF/Aeu/AvXA9Z2s0Dhfx7VKFRlSl1wUCISc7iW3Rc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025