UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KUAG4+4UHOM5t+FAwsswU6ztp15FnqCu+w1SKJUDPK0='
WHERE
key_id = '50b92ca1952be4f3c7fa95e48daf48b258816ecb367f8bad964deca972f3cac5'
AND (
token = 'KUAG4+4UHOM5t+FAwsswU6ztp15FnqCu+w1SKJUDPK0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)