UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XJDKaWQoqdxkPaaUu5ajS1ux1QGrI4+djOUPS5K/FMg='
WHERE
key_id = '5c147b6eb09fe2fd11055d99715a8de214946c0956ab5917c92186527681ec79'
AND (
token = 'XJDKaWQoqdxkPaaUu5ajS1ux1QGrI4+djOUPS5K/FMg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)