UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZNznwMCUDLGEad8fXj6sF2ZgI3xSyZOcWqhVpbNwZlU='
WHERE
key_id = '859e728e4146e4cb1988b9d7fee2e2fa79293ac6135ab0e5a46dca93b8fa2195'
AND (
token = 'ZNznwMCUDLGEad8fXj6sF2ZgI3xSyZOcWqhVpbNwZlU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)