UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CyBpdG/ZglV1cw7ZI5qPa0ScnQO1+CJxXG1bJD9LVGI=' 
WHERE 
  key_id = '523cd80f6d2142fb55ef692915b95ec7b832e9e8a099b0bfcddb35c8163d43f9' 
  AND (
    token = 'CyBpdG/ZglV1cw7ZI5qPa0ScnQO1+CJxXG1bJD9LVGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034