UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CR7fWKbv4n9gSKjfSO19RrBFvv4LLm6XktycH17OTKA='
WHERE
key_id = 'f0af23ea50c776a6b773a76a5c4991291311023214dcf5b5f68acfee660057b4'
AND (
token = 'CR7fWKbv4n9gSKjfSO19RrBFvv4LLm6XktycH17OTKA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)