UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X7rSAMMyVUy7kQl6JwxtiNQUTsUBmxOakV6m20i6Sow='
WHERE
key_id = '2f0bea4b62d6a6567f36881057b1a192192df5a45c58d69968b1e8c3b544bd3f'
AND (
token = 'X7rSAMMyVUy7kQl6JwxtiNQUTsUBmxOakV6m20i6Sow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)