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