UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'va8ch+vBv30qD+fqOHjuQx3/UhL/IspRUw2znVp+Irg=' 
WHERE 
  key_id = 'deb45ac9c26977b7b9dd3e62dc71eb7bef77ff3006f70d44a844841898847951' 
  AND (
    token = 'va8ch+vBv30qD+fqOHjuQx3/UhL/IspRUw2znVp+Irg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024