UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Q1EWj9xQ83mXM79IqMjVZrgmgFbstr3cs5m17nJwtg='
WHERE
key_id = 'ff31c131d8fd626d472c0ac7a1b8013b3f118d0956161479ce21e80db8fbbe37'
AND (
token = '6Q1EWj9xQ83mXM79IqMjVZrgmgFbstr3cs5m17nJwtg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)