UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MM4Mi0SDxt2yrDux9VZMRgolwY9BrztvOS20PiXKhko='
WHERE
key_id = '8d487b78e1e1eae9de4512d5150b14848bf3baa51112340d92c0506fa7b075a9'
AND (
token = 'MM4Mi0SDxt2yrDux9VZMRgolwY9BrztvOS20PiXKhko='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)