UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BvvKjHgXN8LqwEFyLd/dHh3F0xmUzZI3qVtt3fIUMrw='
WHERE
key_id = 'a0368438a9f572e503b98808e4dd03dd019d8107cc23c320e4d900859542936a'
AND (
token = 'BvvKjHgXN8LqwEFyLd/dHh3F0xmUzZI3qVtt3fIUMrw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)