UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rRYAOre+IG+OBmuWKk01I6+eUIPbIG0Y49K+JrK5aOk='
WHERE
key_id = 'aa63455727b5b8dedfcc2b23fd5a77326ae1a6f5ad769184d16cd070eeb979ae'
AND (
token = 'rRYAOre+IG+OBmuWKk01I6+eUIPbIG0Y49K+JrK5aOk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)