UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QO1IuBIfpBdgwjJIW/rxb+p6zKiRi0AOWE57pVJtLJM='
WHERE
key_id = '1822f4d5b8cacf781ad7384eeb3498f34a1e314b24194b07275dc45d2727ab75'
AND (
token = 'QO1IuBIfpBdgwjJIW/rxb+p6zKiRi0AOWE57pVJtLJM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)