UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aOE8ZWWQ8Nt5MGIJYqp35lwQtiLF5b/Uof5RsElMMoM='
WHERE
key_id = 'af3f14648606d82babf331e13d03ebf0d422532e2b66e60efecc93ea9ce290c2'
AND (
token = 'aOE8ZWWQ8Nt5MGIJYqp35lwQtiLF5b/Uof5RsElMMoM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)