UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u+Wk7Y1ApiyOgBh+fmpYzTVHCcc/vDmM+alS2G9weJs='
WHERE
key_id = 'df6950c33137b37746b8e7a67a51d8a3e44c7070f61e755da9b45a989c88a78e'
AND (
token = 'u+Wk7Y1ApiyOgBh+fmpYzTVHCcc/vDmM+alS2G9weJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)