UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uQEmfEpgH6etD682uKE3By4vRTJ7xteTN9Phepwn/2w='
WHERE
key_id = 'de4b8aa5e9a5383391a3de18788337b21458324bb9c55397704e7da1e5c16657'
AND (
token = 'uQEmfEpgH6etD682uKE3By4vRTJ7xteTN9Phepwn/2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)