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