UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0DCSPI1xDBgulvFqRC3gm9OspiAC9Jz0gNkVyGxIMk4='
WHERE
key_id = '52337479cbdac2157903983156f1641e549cf79119b8b6052bae2e7af9a2a6d9'
AND (
token = '0DCSPI1xDBgulvFqRC3gm9OspiAC9Jz0gNkVyGxIMk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)