UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ket5fXQ88aP9LUBuNWNzBw/5WjB+3SmRa1CGDfqYBls='
WHERE
key_id = 'c4155acb1b39082c5ec59f28324883d673e96015101100b366b753a325602cc8'
AND (
token = 'ket5fXQ88aP9LUBuNWNzBw/5WjB+3SmRa1CGDfqYBls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)