UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NwQ9FeI3Iwo83Tp3vVPx36r3ORq9Duk4DQEmJNZl6Gw='
WHERE
key_id = '09364e8ae7a8b62b3bc11bad2e50cdf2e436c158242d148af52f96a2103cddd4'
AND (
token = 'NwQ9FeI3Iwo83Tp3vVPx36r3ORq9Duk4DQEmJNZl6Gw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)