UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yPKq4KliuuSLxxQViuWaA4q5iYk9/ehCYHSdVu1Hi2M=' 
WHERE 
  key_id = '1f3a613b6ae8a59a73ecff5d37bf9d1655673579c2574a089945358ab31b52fe' 
  AND (
    token = 'yPKq4KliuuSLxxQViuWaA4q5iYk9/ehCYHSdVu1Hi2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023