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