UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SSkE1pa45RngYMnbUTUA2xUHBo1EK4K5YKqpeQL8wN0='
WHERE
key_id = '0d09816e08230496cd02d06bea81a032fd03b821c717d9b854e77928e6840d48'
AND (
token = 'SSkE1pa45RngYMnbUTUA2xUHBo1EK4K5YKqpeQL8wN0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)