UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zLdc+BNZ1tgkXDBQggcWjvBZs5qMe1Ida9tbs49lQDQ='
WHERE
key_id = 'a1eec83ad3f0c1d06694c610b6a6d792e43f47ab32ff23958b1e520f4d51f737'
AND (
token = 'zLdc+BNZ1tgkXDBQggcWjvBZs5qMe1Ida9tbs49lQDQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)