UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hdTTe6Ww/CXy5IxPNKTVI/fMpZr8ZpYDg2jIY92NyGA=' 
WHERE 
  key_id = '122bc3ef1bf3b1252602f05a2cd6092c7aefe1e00aeae6932ba31641f884753e' 
  AND (
    token = 'hdTTe6Ww/CXy5IxPNKTVI/fMpZr8ZpYDg2jIY92NyGA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031