UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f7vQhHtx6woUTmN00yuqN+lHhFOjDthQM9oT/F8Mn3Q='
WHERE
key_id = 'cfb8f01c3f78aec164e8ecfa31373c3ab0496330538037f602f238b8aa816e7c'
AND (
token = 'f7vQhHtx6woUTmN00yuqN+lHhFOjDthQM9oT/F8Mn3Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)