UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ia1GIPv93J7EAyo//vCjndyru5oReQSWniN5N+a+a0s='
WHERE
key_id = 'a704f78fe388c9a228589bc25ec3f03c484f2c2bb7c2f51ec0c84855e01d9fce'
AND (
token = 'Ia1GIPv93J7EAyo//vCjndyru5oReQSWniN5N+a+a0s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)