UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ESGrW0CJQHXI3fC42d6G5o42u2+ZIiaHAoing1HudME='
WHERE
key_id = '1619e5b0699b6a82ff2815ebddc082d754de46da7b695fa23bd112e31377f74d'
AND (
token = 'ESGrW0CJQHXI3fC42d6G5o42u2+ZIiaHAoing1HudME='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)