UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6fgYGrDDav/EXk0e+YE65FILyX+tZfvE6hfr5HG9YFU='
WHERE
key_id = '96313cc6190b96502d7faf3a896c869b60333fb20b76c0e4a87b96704754a0c5'
AND (
token = '6fgYGrDDav/EXk0e+YE65FILyX+tZfvE6hfr5HG9YFU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)