UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fEdpym0rC2j4OuOrbY++CGzAGTGVL34ggx16lyjhZac=' 
WHERE 
  key_id = 'fdee8086eae4327aefa3708d9a070f178c543ab756a7a3b1c1376aecab82b073' 
  AND (
    token = 'fEdpym0rC2j4OuOrbY++CGzAGTGVL34ggx16lyjhZac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029