UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l9PLQdO9f9B7p7BuxSTJahxN11NL+KOIkw9Orj5fJKs='
WHERE
key_id = 'be50ac0fd21fed6a89fdf26e9febbe8725a9c33be709d528f9dedc0e99233eb8'
AND (
token = 'l9PLQdO9f9B7p7BuxSTJahxN11NL+KOIkw9Orj5fJKs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)